/**
 * 团购新房详情对话框
 */
var HouseGroupInfoDlg = {
    houseGroupInfoData: {}
};

/**
 * 清除数据
 */
HouseGroupInfoDlg.clearData = function () {
    this.houseGroupInfoData = {};
};

/**
 * 设置对话框中的数据
 *
 * @param key 数据的名称
 * @param val 数据的具体值
 */
HouseGroupInfoDlg.set = function (key, val) {
    this.houseGroupInfoData[key] = (typeof value == "undefined") ? $("#" + key).val() : value;
    return this;
};

/**
 * 设置对话框中的数据
 *
 * @param key 数据的名称
 * @param val 数据的具体值
 */
HouseGroupInfoDlg.get = function (key) {
    return $("#" + key).val();
};

/**
 * 关闭此对话框
 */
HouseGroupInfoDlg.close = function () {
    parent.layer.close(window.parent.HouseGroupCheck.layerIndex);
};

/**
 * 审核通过
 */
HouseGroupInfoDlg.pass = function () {
    var id = $("#id").val();
    var del_reason = $("del_reason").val();
    //提交信息
    var ajax = new $ax(Feng.ctxPath + "/housegroupcheck/pass", function (data) {
                    Feng.success("审核通过!");
                    window.parent.HouseGroupCheck.table.refresh();
                    HouseGroupInfoDlg.close();
                }, function (data) {
                    Feng.error("审核通过失败!" + data.responseJSON.message + "!");
                });
                ajax.set("id",id);
                ajax.set("del_reason",del_reason);
                ajax.start();
};

/**
 * 审核拒绝
 */
HouseGroupInfoDlg.refuse = function () {
    var id = $("#id").val();
    var del_reason = $("del_reason").val();
    //提交信息
    var ajax = new $ax(Feng.ctxPath + "/housegroupcheck/refuse", function (data) {
                    Feng.success("驳回成功!");
                    window.parent.HouseGroupCheck.table.refresh();
                    HouseGroupInfoDlg.close();
                }, function (data) {
                    Feng.error("驳回失败!" + data.responseJSON.message + "!");
                });
                ajax.set("id",id);
                ajax.set("del_reason",del_reason);
                ajax.start();
};

function onBodyDown(event) {
    if (!(event.target.id == "menuBtn" || event.target.id == "menuContent" || $(
            event.target).parents("#menuContent").length > 0)) {
        HouseGroupInfoDlg.hideDeptSelectTree();
    }
}

$(function () {
    Feng.initValidator("houseGroupInfoForm", HouseGroupInfoDlg.validateFields);

});
